const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const path = require('path')
const { srcPath, distPath } = require('./paths')


module.exports = {
  entry: './src/main.js',
  output: {
    filename: '[name]-[hash].bundle.js',
    path: path.join(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        use: 'vue-loader'
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.less$/,
        use: ['style-loader', 'css-loader', 'less-loader']
      },
      // {
      //   test: /\.(png|jpg|gif)$/,
      //   use: [
      //     {
      //       loader: 'file-loader',
      //       options: {
      //         name: '[name].[ext]',
      //         output: 'assets/',
      //         publicPath: './assets'
      //       }
      //     }
      //   ],
      // },
    ]
  },
  plugins: [
    new VueLoaderPlugin(),
    new HtmlWebpackPlugin({
      title: 'vue-app-base',
      filename: 'index.html',
      template: './public/index.html',
      chunks: ['main', 'vendor', 'common']
    })
  ]
}